package com.derschmale.wick3d.core.utils
{
	public class ColourUtils
	{
		public static function toHex(r : Number, g : Number, b : Number) : int
		{
			return ((r*0xff) << 16) + ((g*0xff) << 8) + b*0xff;
		}
		
		public static function redComponent(colour : int) : Number
		{
			return ((colour&0xff0000) >> 16)/0xff;
		}
		
		public static function greenComponent(colour : int) : Number
		{
			return ((colour&0x00ff00) >> 8)/0xff;
		}
		
		public static function blueComponent(colour : int) : Number
		{
			return (colour&0x0000ff)/0xff;
		}
		
		public static function toColour(colour : int) : Colour
		{
			var c : Colour;
			c.r = redComponent(colour);
			c.g = greenComponent(colour);
			c.b = blueComponent(colour);
			return c;
		}
	}
}